package com.ruoyi.web.controller.webs.a2;

import com.ruoyi.a2.dto.A2DynamicsInfoCondition;
import com.ruoyi.a2.dto.A2HPMConfigCondition;
import com.ruoyi.a2.dto.A2HPMConfigForm;
import com.ruoyi.a2.dto.A2HPMConfigJson;
import com.ruoyi.a2.dto.A2PdccCondition;
import com.ruoyi.a2.dto.A2PdccJson;
import com.ruoyi.a2.dto.A2StaticInfoForm;
import com.ruoyi.a2.dto.A2TmpAndIaJson;
import com.ruoyi.a2.dto.TargetPabcJson;
import com.ruoyi.a2.dto.A2StaticInfoCondition;
import com.ruoyi.a2.dto.TargetActivityExtractionJson;
import com.ruoyi.a2.dto.TargetPabcCondition;
import com.ruoyi.a2.service.IA2Service;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.ws.Response;


@Api(tags = "AIS/ADS-B管理（免登录）")
@RestController
@RequestMapping("/webs/a2")
public class A2Controller extends BaseController
{
    @Autowired
    private IA2Service a2Service;

    @ApiOperation("获取2A静态信息列表（分页）")
    @GetMapping("/a2StaticInfoList")
    public TableDataInfo a2StaticInfoList(@Validated @ModelAttribute final A2StaticInfoCondition condition)
    {
        TableDataInfo rspData =  a2Service.a2StaticInfoList(condition);
        rspData.setCode(HttpStatus.SUCCESS);
        rspData.setMsg("查询成功");
        return rspData;
    }

    @ApiOperation("获取2A动态信息列表（分页）")
    @PostMapping("/a2DynamicsInfoList")
    public TableDataInfo a2DynamicsInfoList(@Validated @RequestBody final A2DynamicsInfoCondition condition)
    {
        TableDataInfo rspData =  a2Service.a2DynamicsInfoList(condition);
        rspData.setCode(HttpStatus.SUCCESS);
        rspData.setMsg("查询成功");
        return rspData;
    }

    @ApiOperation("获取2A动态信息历史轨迹")
    @PostMapping("/a2DynamicsInfoHistory")
    public AjaxResult a2DynamicsInfoHistory(@Validated @RequestBody final A2DynamicsInfoCondition condition)
    {
        return AjaxResult.success(a2Service.a2DynamicsInfoHistory(condition));
    }

    @ApiOperation("查询点位数据清洗配置")
    @GetMapping("/getA2Pdcc")
    public AjaxResult getA2Pdcc(@Validated @ModelAttribute final A2PdccCondition condition)
    {
        return AjaxResult.success(a2Service.getA2Pdcc(condition));
    }

    @ApiOperation("批量修改点位数据清洗配置")
    @PostMapping("/updateA2Pdcc")
    public AjaxResult updateA2Pdcc(@Validated @RequestBody final A2PdccJson json)
    {
        a2Service.updateA2Pdcc(json);
        return AjaxResult.success();
    }

    @ApiOperation("批量开始/停止目标活动提取")
    @PostMapping("/startStopTAE")
    public AjaxResult startStopTAE(@Validated @RequestBody final TargetActivityExtractionJson json)
    {
        a2Service.startStopTAE(json);
        return AjaxResult.success();
    }


    @ApiOperation("查询目标异常行为配置")
    @GetMapping("/getTargetPabc")
    public AjaxResult getTargetPabc(@Validated @ModelAttribute final TargetPabcCondition condition)
    {
        return AjaxResult.success(a2Service.getTargetPabc(condition));
    }

    @ApiOperation("批量修改目标异常行为配置")
    @PostMapping("/updateTargetPabc")
    public AjaxResult updateTargetPabc(@Validated @RequestBody final TargetPabcJson json)
    {
        a2Service.updateTargetPabc(json);
        return AjaxResult.success();
    }

    @ApiOperation("批量删除2A静态信息")
    @DeleteMapping("/removeA2StaticInfo/{ids}")
    public AjaxResult removeA2StaticInfo(@PathVariable Long[] ids)
    {
        return toAjax(a2Service.removeA2StaticInfo(ids));
    }

    @ApiOperation("获取2A静态信息详细信息")
    @GetMapping(value = "/getA2StaticInfo/{id}")
    public AjaxResult getA2StaticInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(a2Service.getA2StaticInfo(id));
    }

    @ApiOperation(value = "保存2A静态信息（增加/修改）")
    @PostMapping(path = "/saveOrUpdateA2StaticInfo")
    public AjaxResult saveOrUpdateA2StaticInfo(@Validated @ModelAttribute final A2StaticInfoForm form) {
        return a2Service.saveOrUpdateA2StaticInfo(form);
    }

    //--------------------------------------------历史规律挖掘配置表CRUD START--------------------------------------------
    @ApiOperation("获取历史规律挖掘配置列表（分页）")
    @GetMapping("/a2HPMConfigList")
    public TableDataInfo a2HPMConfigList(@Validated @ModelAttribute final A2HPMConfigCondition condition)
    {
        TableDataInfo rspData = a2Service.a2HPMConfigList(condition);
        rspData.setCode(HttpStatus.SUCCESS);
        rspData.setMsg("查询成功");
        return rspData;
    }

    @ApiOperation("获取历史规律挖掘配置详细信息")
    @GetMapping(value = "/getA2HPMConfig/{id}")
    public AjaxResult getA2HPMConfig(@PathVariable("id") Long id)
    {
        return AjaxResult.success(a2Service.getA2HPMConfig(id));
    }

    @ApiOperation("批量删除历史规律挖掘配置")
    @DeleteMapping("/removeA2HPMConfig/{ids}")
    public AjaxResult removeA2HPMConfig(@PathVariable Long[] ids)
    {
        return toAjax(a2Service.removeA2HPMConfig(ids));
    }

    @ApiOperation(value = "保存历史规律挖掘配置（增加/修改）")
    @PostMapping(path = "/saveOrUpdateA2HPMConfig")
    public AjaxResult saveOrUpdateA2HPMConfig(@Validated @ModelAttribute final A2HPMConfigForm form) {
        return a2Service.saveOrUpdateA2HPMConfig(form);
    }

    @ApiOperation("批量开始/停止历史规律挖掘")
    @PostMapping("/startStopA2HPMConfig")
    public AjaxResult startStopA2HPMConfig(@Validated @RequestBody final A2HPMConfigJson json)
    {
        a2Service.startStopA2HPMConfig(json);
        return AjaxResult.success();
    }
    //--------------------------------------------历史规律挖掘配置表CRUD END--------------------------------------------


    @ApiOperation("目标动向预测和意图研判")
    @PostMapping("/a2TmpAndIa")
    public AjaxResult a2TmpAndIa(@Validated @RequestBody final A2TmpAndIaJson json)
    {
        return AjaxResult.success(a2Service.a2TmpAndIa(json));
    }

}
